package vistaprincipal;

import java.util.ArrayList;
import java.util.List;

public class comparador2 {

 public List <String> Cadena2;   
 public String salida;   
    public comparador2 Comparador(String cadena) {
        String aux;
        comparador2 c2=new comparador2();
        
        c2.Cadena2 = new ArrayList();
        c2.salida="";
        int m = 0;

        for (int i = 0; i < cadena.length(); i++) {
            aux = "";
            cadena = "." + cadena;
            if (cadena.codePointAt(i) == 46) {
                i++;
                while (cadena.codePointAt(i) != 46) {
                    aux = aux + (char) cadena.codePointAt(i);
                    i++;
                }
                
                if (i + 1 < cadena.length()) {
                    
                    c2.salida+="H" + m + ":" + aux + "\n";
                    if(aux.replaceAll(",","@)&").length()>aux.length()){
                        aux=aux.replaceAll(",","@)&");
                        aux="@(&"+aux;
                    }
                    if(aux.replaceAll(":","@(&").length()>aux.length()){
                        aux=aux.replaceAll(":","@(&");
                        aux=aux +"@)&";
                    }
                    c2.Cadena2.add (aux);
                }
                else {
                    aux=aux.replaceAll("Por lo tanto, ","");
                    if(aux.replaceAll(",","@)&").length()>aux.length()){
                        aux=aux.replaceAll(",","@)&");
                        aux="@(&"+aux;
                    }
                    if(aux.replaceAll(":","@(&").length()>aux.length()){
                        aux=aux.replaceAll(":","@(&");
                        aux=aux +"@)&";
                    }
                    c2.Cadena2.add (aux);
                    c2.salida+="---------------\nC:" + aux + "\n";
                }
                m++;
            }
        }
        return c2;
    }
}
